- options = {}
- options[:url] = @form_url if @form_url
- options[:as] = @key if @key
- options.deep_merge!(data: {dialog: params[:dialog]}) if params[:dialog]
- options[:namespace] = params[:namespace] if params[:namespace]

= ekylibre_form_for(resource, options) do |f|
  - if params[:redirect]
    = hidden_field_tag(:redirect, params[:redirect])
  - f.add(:submit, :update.tl, data: {disable_with: :please_wait.tl}, class: 'primary')

  - if params[:form_partial]
    = f.fields(params[:form_partial])
  - else
    = f.fields

  - f.add(:link, :cancel.tl, (params[:redirect] || local_assigns[:cancel_url] || {action: :index}), (params[:dialog] ? {class: 'btn', data: {close_dialog: params[:dialog]}} : {class: 'btn'}))
  = f.actions
